/*   1:    */ package org.jetbrains.generate.tostring.template;
/*   2:    */ 
/*   3:    */

import org.jetbrains.annotations.Nullable;
import org.jetbrains.generate.tostring.util.StringUtil;

import java.io.Serializable;

/*   4:    */
/*   5:    */
/*   6:    */ 
/*   7:    */ public class TemplateResource
/*   8:    */   implements Serializable
/*   9:    */ {
/*  10:    */   private final boolean a;
/*  11: 29 */   private String b = "";
/*  12: 30 */   private String c = "";
/*  13:    */   
/*  14:    */   public TemplateResource(String paramString1, String paramString2, boolean paramBoolean)
/*  15:    */   {
/*  16: 33 */     this.a = paramBoolean;
/*  17: 34 */     this.b = paramString1;
/*  18: 35 */     this.c = paramString2;
/*  19:    */   }
/*  20:    */   
/*  21:    */   public TemplateResource()
/*  22:    */   {
/*  23: 42 */     this.a = false;
/*  24:    */   }
/*  25:    */   
/*  26:    */   public String getTemplate()
/*  27:    */   {
/*  28: 46 */     return this.c;
/*  29:    */   }
/*  30:    */   
/*  31:    */   public void setTemplate(String paramString)
/*  32:    */   {
/*  33: 50 */     this.c = paramString;
/*  34:    */   }
/*  35:    */   
/*  36:    */   public String getFileName()
/*  37:    */   {
/*  38: 54 */     return this.b;
/*  39:    */   }
/*  40:    */   
/*  41:    */   public void setFileName(String paramString)
/*  42:    */   {
/*  43: 58 */     this.b = paramString;
/*  44:    */   }
/*  45:    */   
/*  46:    */   public boolean isDefault()
/*  47:    */   {
/*  48: 62 */     return this.a;
/*  49:    */   }
/*  50:    */   
/*  51:    */   @Nullable
/*  52:    */   public String getJavaDoc()
/*  53:    */   {
/*  54: 72 */     int i = this.c.indexOf("*/");
/*  55: 73 */     if (i == -1) {
/*  56: 74 */       return null;
/*  57:    */     }
/*  58: 77 */     return this.c.substring(0, i + 2);
/*  59:    */   }
/*  60:    */   
/*  61:    */   public String getMethodBody()
/*  62:    */   {
/*  63: 86 */     return a(this.c);
/*  64:    */   }
/*  65:    */   
/*  66:    */   @Nullable
/*  67:    */   private static String a(String paramString)
/*  68:    */   {
/*  69: 91 */     String str1 = b(paramString);
/*  70: 92 */     String str2 = StringUtil.after(paramString, str1);
/*  71: 94 */     if (str2 == null) {
/*  72: 95 */       return null;
/*  73:    */     }
/*  74: 99 */     String str3 = str2.trim();
/*  75:100 */     return str3.substring(1, str3.length() - 1);
/*  76:    */   }
/*  77:    */   
/*  78:    */   public String getMethodSignature()
/*  79:    */   {
/*  80:109 */     return b(this.c);
/*  81:    */   }
/*  82:    */   
/*  83:    */   private static String b(String paramString)
/*  84:    */   {
/*  85:113 */     String str1 = StringUtil.after(paramString, "*/").trim();
/*  86:    */     
/*  87:115 */     StringBuffer localStringBuffer = new StringBuffer();
/*  88:    */     
/*  89:117 */     String[] arrayOfString = str1.split("\n");
/*  90:118 */     for (String str2 : arrayOfString)
/*  91:    */     {
/*  92:119 */       str2 = str2.trim();
/*  93:120 */       if (!str2.startsWith("@"))
/*  94:    */       {
/*  95:123 */         localStringBuffer.append(str2);
/*  96:124 */         if (str2.indexOf('{') > -1) {
/*  97:    */           break;
/*  98:    */         }
/*  99:    */       }
/* 100:    */     }
/* 101:130 */     ??? = localStringBuffer.toString();
/* 102:131 */     return ((String)???).substring(0, ((String)???).lastIndexOf("{"));
/* 103:    */   }
/* 104:    */   
/* 105:    */   public String getTargetMethodName()
/* 106:    */   {
/* 107:138 */     String str = getMethodSignature();
/* 108:139 */     str = StringUtil.before(str, "(");
/* 109:140 */     int i = str.lastIndexOf(" ");
/* 110:141 */     return str.substring(i).trim();
/* 111:    */   }
/* 112:    */   
/* 113:    */   public boolean isValidTemplate()
/* 114:    */   {
/* 115:150 */     return isValidTemplate(this.c);
/* 116:    */   }
/* 117:    */   
/* 118:    */   public static boolean isValidTemplate(String paramString)
/* 119:    */   {
/* 120:160 */     paramString = paramString.trim();
/* 121:162 */     if (paramString.indexOf('{') == -1) {
/* 122:163 */       return false;
/* 123:    */     }
/* 124:167 */     String str = paramString.trim();
/* 125:168 */     if (str.lastIndexOf('}') != str.length() - 1) {
/* 126:169 */       return false;
/* 127:    */     }
/* 128:172 */     if (b(paramString) == null) {
/* 129:173 */       return false;
/* 130:    */     }
/* 131:176 */     if (a(paramString) == null) {
/* 132:177 */       return false;
/* 133:    */     }
/* 134:180 */     return true;
/* 135:    */   }
/* 136:    */   
/* 137:    */   public String toString()
/* 138:    */   {
/* 139:189 */     return this.b != null ? this.b : this.c;
/* 140:    */   }
/* 141:    */   
/* 142:    */   public String getName()
/* 143:    */   {
/* 144:193 */     return this.b;
/* 145:    */   }
/* 146:    */   
/* 147:    */   public boolean equals(Object paramObject)
/* 148:    */   {
/* 149:198 */     if (this == paramObject) {
/* 150:198 */       return true;
/* 151:    */     }
/* 152:199 */     if (!(paramObject instanceof TemplateResource)) {
/* 153:199 */       return false;
/* 154:    */     }
/* 155:201 */     TemplateResource localTemplateResource = (TemplateResource)paramObject;
/* 156:    */     
/* 157:203 */     return (this.b.equals(localTemplateResource.b)) && (this.c.equals(localTemplateResource.c));
/* 158:    */   }
/* 159:    */   
/* 160:    */   public int hashCode()
/* 161:    */   {
/* 162:208 */     return 31 * this.b.hashCode() + this.c.hashCode();
/* 163:    */   }
/* 164:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.generate.tostring.template.TemplateResource

 * JD-Core Version:    0.7.0.1

 */